import App from './App'

// #ifndef VUE3
import Vue from 'vue'

import uView from "uview-ui";
Vue.use(uView);

import store from './store'
Vue.prototype.$store = store

// 工具函数
import utils from './common/js/utils';
Vue.prototype.utils = utils;

// #ifdef MP-WEIXIN
// 广告函数
import adUtils from './common/js/ad';
Vue.prototype.adUtils = adUtils;

//隐私协议组件
import privacy from '@/components/privacy/privacy.vue';
Vue.component('privacy',privacy);

//原生模板广告
import adcustom from '@/components/adcustom/adcustom.vue';
Vue.component('adcustom',adcustom);

//头像昵称组件
import setuser from '@/components/setuser/setuser.vue';
Vue.component('setuser',setuser);

// 引入uView对小程序分享的mixin封装
const mpShare = require('@/uni_modules/uview-ui/libs/mixin/mpShare.js')
Vue.mixin(mpShare)
// #endif

// #ifdef H5
var jweixin = require('jweixin-module');
Vue.prototype.$jweixin = jweixin
// #endif

// 应用配置
const app_info = require("@/static/appInfo.js");
Vue.prototype.appInfo = app_info

// 底部导航栏组件
import tabbar from '@/components/tabbar/tabbar.vue';
Vue.component('tabbar', tabbar);

// 统一请求函数
Vue.prototype.http = function(path, data, method = 'post', showLoading = false) {
	return utils.http(this, path, data, method, showLoading)
}

// 让app的onLaunch先执行，主要是用来进行登录
Vue.prototype.$onLaunched = new Promise(resolve => {
    Vue.prototype.$isResolve = resolve
})

Vue.config.productionTip = false
Vue.config.ignoredElements.push('wx-open-subscribe')

App.mpType = 'app'
Vue.use(uView)

const app = new Vue({
	store,
    ...App
})
app.$mount()
// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp() {
  const app = createSSRApp(App)
  return {
    app
  }
}
// #endif